import 'package:flutter/material.dart';

// //加载远程图片
class Image1 extends StatelessWidget {
  const Image1({super.key});

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Container(
        height: 200,
        width: 200,
        decoration: BoxDecoration(color: Colors.yellow),
        child: Image.network(
            'https://img0.baidu.com/it/u=3809224734,4144483969&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=666'),
      ),
    );
  }
}

class Image2 extends StatelessWidget {
  const Image2({super.key});

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Container(
        width: 150,
        height: 150,
        decoration: BoxDecoration(
            color: Colors.white,
            //borderRadius: BorderRadius.circular(75),
            image: const DecorationImage(
                image: NetworkImage(
                  "https://www.itying.com/themes/itying/images/ionic4.png",
                ),
                //fit: BoxFit.cover
                fit: BoxFit.cover //自动裁剪适配宽高
                )),
      ),
    );
  }
}

class Image3 extends StatelessWidget {
  const Image3({super.key});

  @override
  Widget build(BuildContext context) {
    return Center(
      child: ClipOval(
        child: Image.network(
            "https://www.itying.com/themes/itying/images/ionic4.png",
            width: 250.0,
            height: 250.0,
            fit: BoxFit.cover),
      ),
    );
  }
}

class Image4 extends StatelessWidget {
  const Image4({super.key});

  @override
  Widget build(BuildContext context) {
    return const Center(
      child: CircleAvatar(
          radius: 102,
          backgroundColor: Color(0xffFDCF09),
          child: CircleAvatar(
            radius: 100,
            backgroundImage: NetworkImage(
                "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2F9b0e4511-18a2-4964-b29e-fa5d754ee257%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1704899284&t=12f449c7957ac085c422d8dadcc667f0"),
          )),
    );
  }
}

class Image5 extends StatelessWidget {
  const Image5({super.key});

  @override
  Widget build(BuildContext context) {
    return Center(
      child: ClipOval(
        // child: Image.asset("images/avatar.png",
        // child: Image.asset("images/002.jpg",
        child: Image.asset("images/2.0x/002.jpg",
            width: 150.0, height: 150.0, fit: BoxFit.cover),
      ),
    );
  }
}
